/**
 * Coryright 2015-2020 www.eyaomall.cn
 * All rights reserved.
 * @author yiwei
 * @date 2016年9月20日
 */
package com.eyaomall.wxmall.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eyaomall.wxmall.common.helper.MemberHelper;
import com.eyaomall.wxmall.model.po.MicroPage;
import com.eyaomall.wxmall.service.MicroPageService;
import com.lycheeframework.core.cmp.api.http.GsnData;
import com.lycheeframework.core.cmp.api.http.GsnResponse;
import com.lycheeframework.core.cmp.kit.PageHTTPObject;

/**
 * Coryright 2015-2020 www.eyaomall.cn
 * All rights reserved.
 * @author yiwei
 * @date 2016年9月20日
 * 微页面controller
 */
@Controller
@RequestMapping("micro_page")
public class MicroPageController {
	@Autowired
	private MicroPageService microPageService;

	
	/**
	 * 查询微页面信息分页
	 */
	@RequestMapping("page_data")
	public @ResponseBody GsnData page_data(MicroPage microPage, PageHTTPObject httpObject) {
		microPage.setShopId(MemberHelper.getShopId());
		return GsnResponse.toData(microPageService.page(microPage, httpObject));
	}
	
	/**
	 * 进入详情页
	 */
	@RequestMapping("detail")
	public String detail(Integer id,Map<String, Object> mode) {
		if(id!= null && id >= 0){
			mode.put("micro",microPageService.queryById(id));
		}
		return "malldesc/micro_page_detail";
	}
}
